﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using ESRI.ArcGIS.Carto;
using PlanningGIS.ArcGIS;
using PlanningGIS.Win.Controls;

namespace PlanningGIS.Statistics
{
    public partial class FrmLayerSelector : Office2007Form 
    {
        private IFeatureLayer pFeatureLayer;
        public IFeatureLayer FeatureLayer
        { 
            get { return pFeatureLayer; } 
        }

        public FrmLayerSelector(object hook, zjgisShapeType shapeType)
        {
            InitializeComponent();

            lyrCbo.ShapeType = shapeType;
            lyrCbo.OnCreate(hook);
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            Close();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (lyrCbo.SelectedLayer == null)
            {
                MsgHelper.ShowWarningMsgbox("请先选择数据！");
                return;
            }

            pFeatureLayer = lyrCbo.SelectedLayer as IFeatureLayer;
            DialogResult = DialogResult.OK;
            Close();
        }
    }
}
